package week8;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main6 
{
	public static void main(String[] args) 
	{
		Scanner in = new Scanner(System.in);
		Queue<Integer> queue1 = new LinkedList<Integer>();
		Queue<Integer> queue2 = new LinkedList<Integer>();
		int a = in.nextInt();
		for (int i = 0; i < a; i++) 
		{
			int b =in.nextInt();
			if(b%2==1)
				queue1.offer(b);
			else
				queue2.offer(b);
		}
		while(!queue1.isEmpty()||!queue2.isEmpty())
		{	
			if(!queue1.isEmpty())
			{
				System.out.print(queue1.poll());
				if(queue1.isEmpty()&&queue2.isEmpty())
					break;
				else
					System.out.print(" ");
			}
			if(!queue1.isEmpty())
			{
				System.out.print(queue1.poll());
				if(queue1.isEmpty()&&queue2.isEmpty())
					break;
				else
					System.out.print(" ");
			}
			if(!queue2.isEmpty())
			{
				System.out.print(queue2.poll());
				if(queue1.isEmpty()&&queue2.isEmpty())
					break;
				else
					System.out.print(" ");
			}
		}
	}
}
